<template>
	<view class="">
		<view class="header">
			<image src="../../static/image/mine/integral/header_banner1.png" mode=""></image>
			<view class="userinfo">
				<view class="userinfo_l">
					<image src="../../static/image/mine/header.png" mode=""></image>
					<text>Hello,16602197016</text>
				</view>
				<view class="userinfo_r" @tap="tohistory">
					兑换历史
				</view>
			</view>
			<view class="integra_info">
				<image src="../../static/image/mine/integral/integral_banner.png" mode=""></image>
				<view class="integra_info_info">
					<view class="info_t">
						您当前的积分为
					</view>
					<view class="info_b">
						<view class="info_b_num">
							296
						</view>
						<view class="info_b_detail" @tap="todetail">
							积分明细 >
						</view>
					</view>
					<view class="integral_rule">
						积分规则
					</view>
				</view>
			</view>
		</view>
		<!-- 活动海报 -->
		<view class="active_banner">
			<image src="../../static/image/mine/integral/banner.png" mode=""></image>
		</view>
		<!-- 商品列表 -->
		<view class="product_list">
			<view class="tilte">
				精选超值兑换
			</view>
			<view class="product" v-for="(item,index) in product" @tap="toproduct(index)">
				<image :src="item.pic" mode=""></image>
				<view class="product_info">
					<view class="product_info_t">
						<view class="title">
							{{item.title}}
						</view>
						<view class="exchange_num">
							已兑换{{item.exchangeNum}}万件
						</view>
					</view>
					<view class="product_info_b">
						<text class="integral_num">{{item.integral}}</text>/积分
						<text class="price">￥{{item.price}}</text>
					</view>
					<!-- <image class="toexchange" src="../../static/image/mine/integral/toexchange.png" mode=""></image> -->
					<view class="toexchange">
						去兑换
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data () {
			return {
				product: [
					{
						pic:'../../static/image/mine/integral/product11.png',
						title:'荥阳豫河阴突尼斯软籽石榴水果新鲜包邮软子红甜无籽石榴一级大果',
						exchangeNum: '5',
						integral: 1200,
						price: '179.00'
					},
					{
						pic:'../../static/image/mine/integral/product12.png',
						title:'荥阳豫河阴突尼斯软籽石榴水果新鲜包邮软子红甜无籽石榴一级大果',
						exchangeNum: '5.1',
						integral: 1200,
						price: '199.00'
					},
					{
						pic:'../../static/image/mine/integral/product13.png',
						title:'荥阳豫河阴突尼斯软籽石榴水果新鲜包邮软子红甜无籽石榴一级大果',
						exchangeNum: '1',
						integral: 1500,
						price: '169.00'
					},
					{
						pic:'../../static/image/mine/integral/product14.png',
						title:'荥阳豫河阴突尼斯软籽石榴水果新鲜包邮软子红甜无籽石榴一级大果',
						exchangeNum: '1',
						integral: 1900,
						price: '169.00'
					}
				]
			}
		},   
		methods: {
			tohistory () {
				uni.navigateTo({
					url: '/pageA/integral/changehistory'
				})
			},
			todetail () {
				uni.navigateTo({
					url: '/pageA/integral/integral_detail'
				})
			},
			toproduct (index) {
				// uni.navigateTo({
				// 	url: '/pageA/integral/product'
				// })
				uni.navigateTo({
					url: '/pageB/classify/productdetail?id='+index+'&type='+'2'
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.header {
		width: 100%;
		height: 253upx;
		position: relative;
		image {
			width: 100%;
			height: 100%;
		}
		.userinfo {
			position: absolute;
			left: 50%;
			top: 0;
			transform: translate(-50%);
			width: 660upx;
			height: 100upx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.userinfo_l {
			display: flex;
			align-items: center;
				image {
					width: 84upx;
					height: 84upx;
					margin-right: 20upx;
				}
				text {
					font-size: 28upx;
					color: #FFFFFF;
				}
			}
			.userinfo_r {
				width: 120upx;
				height: 36upx;
				font-size: 24upx;
				color: #FFFFFF;
				background-color: #f96559;
				text-align: center;
				line-height: 36upx;
				border-radius: 8upx;
			}
		}
		.integra_info {
			position: absolute;
			left: 50%;
			transform: translate(-50%);
			bottom: 0;
			width: 660upx;
			height: 148upx;
			image {
				width: 100%;
				height: 100%;
			}
			.integra_info_info {
				position: absolute;
				top: 0;
				left: 0;
				padding: 0 30upx;
				box-sizing: border-box;
				width: 100%;
				height: 130upx;
				.info_t {
					margin-top: 25upx;
					font-size: 24upx;
					color: #333333;
				}
				.info_b {
					margin-top: 15upx;
					display: flex;
					justify-content: space-between;
					align-items: flex-end;
					.info_b_num {
						font-size: 40upx;
						color: #333333;
						font-weight: bold;
					}
					.info_b_detail {
						font-size: 24upx;
						color: #333333;
					}
				}
				.integral_rule {
					position: absolute;
					right: 0;
					top: 25upx;
					background-color: #333;
					color: #FFFFFF;
					width: 120upx;
					height: 36upx;
					font-size: 24upx;
					text-align: center;
					line-height: 36upx;
					border-top-left-radius: 18upx;
					border-bottom-left-radius: 18upx;
				}
			}
		}
	}
	.active_banner {
		width: 720upx;
		height: 190upx;
		margin: 20upx auto;
		image {
			width: 100%;
			height: 100%;
		}
	}
	.product_list {
		width: calc(100% - 30upx);
		margin: auto;
		.tilte {
			font-size: 32upx;
			color: #333333;
			font-weight: bold;
			margin-bottom: 30upx;
		}
		.product {
			margin-bottom: 20upx;
			width: 100%;
			padding: 25upx 15upx;
			box-sizing: border-box;
			background-color: #FFFFFF;
			display: flex;
			align-items: center;
			image {
				width: 180upx;
				height: 180upx;
				margin-right: 25upx;
			}
			.product_info {
				flex: 1;
				height: 180upx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				position: relative;
				.product_info_t {
					.title {
						font-size: 28upx;
						color: #333333;
						line-height: 36upx;
					}
					.exchange_num {
						margin-top: 10upx;
						font-size: 24upx;
						color: #f73e2f;
					}
				}
				.product_info_b {
					font-size: 20upx;
					color: #f73e2f;
					.integral_num {
						font-size: 24upx;
						font-weight: bold;
					}
					.price {
						margin-left: 20upx;
						color: #999999;
						text-decoration: line-through;
					}
				}
				.toexchange {
					position: absolute;
					bottom: 0;
					right: 10upx;
					width: 140upx;
					height: 52upx;
					background: linear-gradient(to right,#f73e2f 0%,#fe675b 100%);
					border-radius: 26upx;
					font-size: 28upx;
					color: #FFFFFF;
					text-align: center;
					line-height: 52upx;
				}
			}
		}
	}
</style>
